package com.yjd.comm.borrow.convert;

import java.util.List;

import com.yjd.comm.borrow.enums.InvestChannelEnum;
import com.yjd.comm.borrow.model.InvestModel;
import com.yjd.comm.util.DateUtil;

/**
 * <b>description</b>：投标记录转换器 <br>
 * <b>time</b>：2014-11-15下午4:37:26 <br>
 * <b>author</b>： ready likun_557@163.com
 */
public class InvestModelConvert {

	public static InvestModel convert(InvestModel model) throws Exception {
		if (model != null) {
			model.getStrMap().put("addtime",
					DateUtil.timestampToDateString(model.getAddtime()));
			model.getStrMap().put("channel",
					InvestChannelEnum.getDesc(model.getChannel()));
		}
		return model;
	}

	public static List<InvestModel> convert(List<InvestModel> models)
			throws Exception {
		if (models == null || models.size() == 0) {
			return models;
		}
		for (InvestModel model : models) {
			convert(model);
		}
		return models;
	}

}
